<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- threads.qdoc -->
  <title>Thread Support in Qt | Qt 5.14</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt 5.14</a></td><td >Thread Support in Qt</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.14.2 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="next" href="threads-technologies.html" />
<p class="naviNextPrevious headerNavi">
<a class="nextPage" href="threads-technologies.html">Multithreading Technologies in Qt</a>
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#topics">Topics:</a></li>
<li class="level1"><a href="#the-threading-classes">The Threading Classes</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Thread Support in Qt</h1>
<span class="subtitle"></span>
<!-- $$$threads.html-description -->
<div class="descr"> <a name="details"></a>
<p>Qt provides thread support in the form of platform-independent threading classes, a thread-safe way of posting events, and signal-slot connections across threads. This makes it easy to develop portable multithreaded Qt applications and take advantage of multiprocessor machines. Multithreaded programming is also a useful paradigm for performing time-consuming operations without freezing the user interface of an application.</p>
<p>Earlier versions of Qt offered an option to build the library without thread support. Since Qt 4.0, threads are always enabled.</p>
<a name="topics"></a>
<h2 id="topics">Topics:</h2>
<p>These articles assume that the reader has basic knowledge about multithreaded applications.</p>
<ul>
<li><a href="threads.html#the-threading-classes">The Threading Classes</a></li>
<li><a href="threads-technologies.html">Multithreading Technologies in Qt</a></li>
<li><a href="threads-synchronizing.html">Synchronizing Threads</a></li>
<li><a href="threads-reentrancy.html">Reentrancy and Thread-Safety</a></li>
<li><a href="threads-qobject.html">Threads and QObjects</a></li>
<li><a href="threads-modules.html">Thread-Support in Qt Modules</a></li>
</ul>
<a name="the-threading-classes"></a>
<h2 id="the-threading-classes">The Threading Classes</h2>
<p>These classes are relevant to threaded applications.</p>
<div class="table"><table class="annotated">
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtconcurrent/qtconcurrentfilter.html">Concurrent Filter and Filter-Reduce</a></p></td><td class="tblDescr"><p></p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtconcurrent/qtconcurrentmap.html">Concurrent Map and Map-Reduce</a></p></td><td class="tblDescr"><p></p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtconcurrent/qtconcurrentrun.html">Concurrent Run</a></p></td><td class="tblDescr"><p></p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtcore/qatomicinteger.html">QAtomicInteger</a></p></td><td class="tblDescr"><p>Platform-independent atomic operations on integers</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtcore/qatomicpointer.html">QAtomicPointer</a></p></td><td class="tblDescr"><p>Template class that provides platform-independent atomic operations on pointers</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtcore/qfuture.html">QFuture</a></p></td><td class="tblDescr"><p>Represents the result of an asynchronous computation</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtcore/qfuturesynchronizer.html">QFutureSynchronizer</a></p></td><td class="tblDescr"><p>Convenience class that simplifies QFuture synchronization</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtcore/qfuturewatcher.html">QFutureWatcher</a></p></td><td class="tblDescr"><p>Allows monitoring a QFuture using signals and slots</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtcore/qmutex.html">QMutex</a></p></td><td class="tblDescr"><p>Access serialization between threads</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtcore/qmutexlocker.html">QMutexLocker</a></p></td><td class="tblDescr"><p>Convenience class that simplifies locking and unlocking mutexes</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtcore/qreadlocker.html">QReadLocker</a></p></td><td class="tblDescr"><p>Convenience class that simplifies locking and unlocking read-write locks for read access</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtcore/qreadwritelock.html">QReadWriteLock</a></p></td><td class="tblDescr"><p>Read-write locking</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtcore/qrecursivemutex.html">QRecursiveMutex</a></p></td><td class="tblDescr"><p>Access serialization between threads</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtcore/qrunnable.html">QRunnable</a></p></td><td class="tblDescr"><p>The base class for all runnable objects</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtcore/qsemaphore.html">QSemaphore</a></p></td><td class="tblDescr"><p>General counting semaphore</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtcore/qsemaphorereleaser.html">QSemaphoreReleaser</a></p></td><td class="tblDescr"><p>Exception-safe deferral of a QSemaphore::release() call</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtcore/qthread.html">QThread</a></p></td><td class="tblDescr"><p>Platform-independent way to manage threads</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtcore/qthreadpool.html">QThreadPool</a></p></td><td class="tblDescr"><p>Manages a collection of QThreads</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtcore/qthreadstorage.html">QThreadStorage</a></p></td><td class="tblDescr"><p>Per-thread data storage</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtcore/qwaitcondition.html">QWaitCondition</a></p></td><td class="tblDescr"><p>Condition variable for synchronizing threads</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="../qtcore/qwritelocker.html">QWriteLocker</a></p></td><td class="tblDescr"><p>Convenience class that simplifies locking and unlocking read-write locks for write access</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="../qtconcurrent/qtconcurrent.html">QtConcurrent</a></p></td><td class="tblDescr"><p>High-level APIs that make it possible to write multi-threaded programs without using low-level threading primitives</p></td></tr>
</table></div>
<p><b>Note: </b>Qt's threading classes are implemented with native threading APIs; e.g&#x2e;, Win32 and pthreads. Therefore, they can be used with threads of the same native API.</p></div>
<!-- @@@threads.html -->
<p class="naviNextPrevious footerNavi">
<a class="nextPage" href="threads-technologies.html">Multithreading Technologies in Qt</a>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
